package com.ruoyi.stuclient.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.ruoyi.stuclient.domain.EwcSmsTemplate;
import com.ruoyi.stuclient.domain.EwcStudent;
import com.ruoyi.stuclient.domain.dto.SMSGetDto;
import com.ruoyi.stuclient.mapper.EwcSmsTemplateMapper;
import com.ruoyi.stuclient.service.IEwcSmsTemplateService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.validation.Valid;

/**
 * 短信模板信息Service业务层处理
 *
 * @author zsp
 * @date 2025-05-01
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class EwcSmsTemplateServiceImpl extends MPJBaseServiceImpl<EwcSmsTemplateMapper, EwcSmsTemplate> implements IEwcSmsTemplateService {

    @Override
    public String getTemplateContent(@Valid SMSGetDto smsGetDto) {
        QueryWrapper<EwcSmsTemplate> wrapper = new QueryWrapper<>();
        wrapper.select("template_content")
                .eq("template_id", smsGetDto.getTemplateId());
        EwcSmsTemplate ewcSmsTemplate = this.getOne(wrapper);
        return ewcSmsTemplate != null ? ewcSmsTemplate.getTemplateContent() : null;
    }
}
